package org.footballmanager.pandafootball.system.form.impl;

import lombok.Getter;
import lombok.Setter;
import org.footballmanager.pandafootball.system.domain.FootCupbf;
import org.footballmanager.pandafootball.system.domain.enums.BFLX;
import org.footballmanager.pandafootball.system.domain.enums.BFZT;
import org.footballmanager.pandafootball.system.form.SearchForm;
import tk.mybatis.mapper.entity.Example;

import java.io.Serializable;

@Getter
@Setter
public class FootCupbfSearchForm extends SearchForm implements Serializable {
    private static final long serialVersionUID = 8090668615941861525L;
    protected Long sj;
    protected BFZT bfzt;
    protected BFLX bflx;
    protected String bfUserName;

    public Example buildSearchCommond() {
        Example example = new Example(FootCupbf.class);
        Example.Criteria criteria = example.createCriteria();
        if (sj != null) {
            criteria.andEqualTo("sj", sj);
        }
        if (null == bfzt) {
            criteria.andEqualTo("bfzt", BFZT.HAVE);
        } else {
            criteria.andEqualTo("bfzt", bfzt);
        }
        if (null != bflx) {
            criteria.andEqualTo("bflx", bflx);
        }
        criteria.andEqualTo("delFlag", 0);
        example.orderBy("sj").desc();
        return example;
    }

}
